package com.heima.admin.controller.v1;

import com.heima.admin.service.AdChannerService;
import com.heima.admin.service.AdSensitiveService;
import com.heima.model.admin.dtos.ChannelDto;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdChannel;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(value = "敏感词管理",tags = "sensitive",description = "敏感词管理API")
@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController {
    @Autowired
    private AdSensitiveService adSensitiveService;

    @ApiOperation("敏感词分页列表查询")
    @PostMapping("/list")
    public ResponseResult findPage(@RequestBody SensitiveDto dto){
        return adSensitiveService.findPage(dto);
    }


    @ApiOperation("敏感词新增")
    @PostMapping("/save")
    public ResponseResult add(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.add(adSensitive);
    }


    @ApiOperation("敏感词修改")
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive){
        return adSensitiveService.update(adSensitive);
    }


    @ApiOperation("敏感词删除")
    @DeleteMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id")Integer id){
        return adSensitiveService.deleteById(id);
    }


}
